// 统一管理项目中所有的请求路径 api
import request from "./index";

//! 用户
// 登录
export const login = (params: any) =>
  request.post("/portal_noauth/user/login", params);

//! 新闻
// 查看新闻列表
export const getNews = () => request.get("/portal_noauth/news/pages?title");
// 查看新闻详情
export const getNewsDesc = (id: any) =>
  request.get(`/portal_noauth/news/${id}`);
//! 新闻配置
// 查看新闻列表
export const operator_getNews = (title: any) =>
  request.get(`/portal/news/pages?title=${title}`);
// 删除新闻
export const deleteNews = (id: any) => request.delete(`/portal/news/${id}`);
// 批量删除新闻
export const batch_delete = (ids: any) =>
  request.post(`/portal/news/batch_delete`, ids);
// 添加新闻
export const addNews = (params: any) => request.post(`/portal/news`, params);
// 上传文件
export const addFiles = (params: any) =>
  request.post(`/portal/upload_file/upload_files`, params);
// 修改新闻
export const putNews = (id: any, params: any) =>
  request.put(`/portal/news/${id}`, params);

// 上架新闻
export const news_publish = (ids: any) =>
  request.post(`/portal/news/publish`, ids);
// 下架新闻
export const news_unpublish = (ids: any) =>
  request.post(`/portal/news/unpublish`, ids);
